<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .c1 {
            color: red;
        }

        .c2 {
            background-color: #5f5750;
        }

        .c3 {
            font-size: 40px;
        }

        .c4 {
            border: 1px red solid;
        }
    </style>
</head>
<body>
    <div class="c1 c4">alex</div>
    <button id="change">change</button>

    <script>
        var change = document.getElementById('change');
        var ele = document.getElementsByClassName('c1')[0];

        change.onclick = function () {
            // ele.classList.add('c2');
            ele.classList.add('c2','c3');  // 增加class属性值
            ele.classList.remove('c4');    // 删除class属性值
        }
    </script>
</body>
</html>